package com.yunhai.xc.test;

import javax.servlet.http.HttpSession;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/session")
public class Session {
	// 如果没有实现session共享的话 shiro的默认session是存在tomcat中的
	// 引入spring-session-data-redis实现session共享之后
	// shiro session会保存在redis当中
	@RequestMapping("/p1")
	public String setSession(HttpSession session) {
		session.setAttribute("hx", "1打9");
		return "session set success";
	}

	@RequestMapping("/p2")
	public String getSession(HttpSession session) {
		System.out.println(session.getAttribute("hx"));
		return "success";
	}
}
